-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't crash when no argument is given #1207
Conversation
Dang, do I feel dumb now. |
Don't crash when no argument is given
@@ -924,7 +924,8 @@ def _raw_main(args, lib=None): | |||
# Special case for the `config --edit` command: bypass _setup so | |||
# that an invalid configuration does not prevent the editor from | |||
# starting. | |||
if subargs[0] == 'config' and ('-e' in subargs or '--edit' in subargs): | |||
if subargs and subargs[0] == 'config' \ | |||
and ('-e' in subargs or '--edit' in subargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the indentation off by one? Eh. I guess flake8 didn't complain so it's probably all good. Just seemed odd to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I guess it just follows the identation of "subargs". Right. I'm too tired to look at code right now. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I guess it's visually aligned with the start of the expression on the previous line. In any case, feel free to fiddle with it using your newfound commit powers. 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's right! How would you prefer it to be? That's what pep8 prefers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good actually! It's just a bit funny because it's 3 spaces, which is almost 4 spaces. Let's leave it.
Check that there is a sub-argument before getting the first one. Fixes issue #1205